package com.credithc.signature.lanmaostorage.controller;

import com.credithc.signature.lanmaostorage.ro.FileRo;
import com.credithc.signature.lanmaostorage.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhanghanqiu181212@credithc.com
 * @Date 2020/6/11 15:46
 */
@Controller("/api/scs/v2/storage/fail")
public class FileController {

    @Autowired
    FileService fileService;

    /**
     * 文档存储（永久）
     * @param fileRo
     * @return
     * @throws Exception
     */
    @PostMapping(value="/storage")
    @ResponseBody
    public ResponseEntity<Object> storage(@RequestBody FileRo fileRo) throws Exception{
        return fileService.storage(fileRo,"contPath");
    }

    /**
     * 图片存储（永久）
     * @param fileRo
     * @return
     * @throws Exception
     */
    @PostMapping(value="/storage/image")
    @ResponseBody
    public ResponseEntity<Object> storageImage(@RequestBody FileRo fileRo) throws Exception{
        return fileService.storage(fileRo,"imgPath");
    }
    /**
     * 文档存储（临时）
     * @param fileRo
     * @return
     * @throws Exception
     */
    @PostMapping(value="/storage/tmp")
    @ResponseBody
    public ResponseEntity<Object> storageTmp(@RequestBody FileRo fileRo) throws Exception{
        return fileService.storage(fileRo,"contTemPath");
    }
}
